// typeid
// typeid can not get the class const information.

#include <iostream>
#include <typeinfo>
using namespace std;

class A {
	virtual void foo( ) {}
};
class B : public A {};

// designer
// ------------------------------------------------------------------
// user

int main( void ) {

	int m;
	const type_info& ret = typeid( m );
	// 1. Get the information of m.
	// 2. Create a type_info's object.
	// 3. Save the information of m into type_info object "private member values".
	// 4. Return type_info' class constent cite.
	
	string rn = ret.name( );	
	cout << rn << endl;	// i	The type of member.

	const int n = m;
	cout << typeid( n ).name( ) << endl; // i

	cout << (typeid( m ) == typeid( n )) << endl;
	cout << (typeid( m ) != typeid( n )) << endl;
	
	B b;
	A* pa = &b;
	A& ra = b;
	
	cout << (typeid( *pa ).name( )) << endl;
	cout << (typeid( ra ).name( )) << endl;

	return 0;
}

